﻿@using EveKillboard.Content
@model IEnumerable<EveKillboard.Core.Corporation>
@{
    var previous = ViewData.ContainsKey("previous") && ViewData["previous"] != null ? (string) ViewData["previous"] : null;
    var next = ViewData.ContainsKey("next") && ViewData["next"] != null ? (string)ViewData["next"] : null;
}
<div class="navigationBar">
    <div class="navigation">
        <img id="imgPrevious" width="16px" height="16px" src alt/>
        <a id="previous" class="evelink" onclick="evekillboard.load(@previous)">@Labels.previous</a>
        <a id="next" class="evelink" onclick="evekillboard.load(@next)">@Labels.next</a>
        <img id="imgNext" width="16px" height="16px" src alt/>
    </div>
</div>
<table id="corporations">
    <thead>
        <tr class="gradientheader">
            <th></th>
            <th><a class="headerlink" title="Sort by ID" onclick="evekillboard.load(@string.Format("'{0}?index={1}&sort={2}&sortOrder={3}'", Url.Action("Corporations", "Admin"), ViewData["index"], "Id", ViewData["sortOrder"]))">ID</a></th>
            <th><a class="headerlink" title="Sort by Name" onclick="evekillboard.load(@string.Format("'{0}?index={1}&sort={2}&sortOrder={3}'", Url.Action("Corporations", "Admin"), ViewData["index"], "Name", ViewData["sortOrder"]))">Name</a></th>
            <th><a class="headerlink" title="Sort by Eve ID" onclick="evekillboard.load(@string.Format("'{0}?index={1}&sort={2}&sortOrder={3}'", Url.Action("Corporations", "Admin"), ViewData["index"], "EveId", ViewData["sortOrder"]))">Eve ID</a></th>
            <th><a class="headerlink" title="Sort by Alliance" onclick="evekillboard.load(@string.Format("'{0}?index={1}&sort={2}&sortOrder={3}'", Url.Action("Corporations", "Admin"), ViewData["index"], "LastKnownAlliance", ViewData["sortOrder"]))">Alliance</a></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var corp in Model){
            <tr>
                <td class="action"><a class="evelink" onclick="evekillboard.edit(@Html.Raw(string.Format("'{0}'", Url.Action("Edit", "Admin"))),@corp.Id,1)">Edit</a>&nbsp;<a class="evelink" onclick="evekillboard.del(@Html.Raw(string.Format("'{0}'", Url.Action("DeleteCorporation", "Admin"))),@corp.Id)">Delete</a></td>
                <td class="id">@corp.Id</td>
                <td class="name">@corp.Name</td>
                <td class="id">@corp.EveId</td>
                <td class="name">@corp.LastKnownAlliance</td>
            </tr>
        }
    </tbody>
</table>
